﻿using LanzhouBeefNoodles.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace LanzhouBeefNoodles.Data
{
    public class FeedbackData : IFeedback
    {
        private readonly AppDbContext _db;
        public FeedbackData(AppDbContext appDbContext)
        {
            _db = appDbContext;
        }

        public void AddFeedback(Feedback feedback)
        {
             _db.Add(feedback); //添加数据
            _db.SaveChanges(); //保存添加得数据，不保存无效
        }

        public IEnumerable<Feedback> GetAllFeedbacks()
        {
            return _db.Feedbacks;
        }
    }
}
